/ MacTech 1 to 12
/ MacTech-vol-1-12.toast / Source / develop™ Technical Journal / develop Issue 26 code / Truffles-Display Mgr.sit / Truffles - Display Mgr. / SuperFly source / LinkedList.cp ![]() | < prev | next > |
MacBinary | 1996-01-17 | 2.6 KB | [TEXT/CWIE] |
Confidence | Program | Detection | Match Type | Support |
---|---|---|---|---|
10% | dexvert | MacBinary (archive/macBinary) | fallback | Supported |
1% | dexvert | MS-DOS Code Page Info (other/dosCodePage) | ext | Unsupported |
1% | dexvert | Text File (text/txt) | fallback | Supported |
100% | file | MacBinary II, inited, Wed Jan 17 15:19:27 1996, modified Wed Jan 17 15:19:27 1996, creator 'CWIE', type ASCII, 1923 bytes "LinkedList.cp" , at 0x803 410 bytes resource | default (weak) | |
99% | file | data | default | |
74% | TrID | Macintosh plain text (MacBinary) | default | |
25% | TrID | MacBinary 2 | default (weak) | |
100% | siegfried | fmt/1762 MacBinary (II) | default | |
100% | lsar | MacBinary | default |
id metadata | |
---|---|
key | value |
macFileType | [TEXT] |
macFileCreator | [CWIE] |
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0d 4c 69 6e 6b 65 64 | 4c 69 73 74 2e 63 70 00 |..Linked|List.cp.|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 07 83 00 | 00 01 9a ad 23 0a 4f ad |........|....#.O.|
|00000060| 23 0a 4f 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |#.O.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 b6 83 00 00 |........|........|
|00000080| 2f 2a 0d 09 46 69 6c 65 | 3a 09 09 4c 69 6e 6b 65 |/*..File|:..Linke|
|00000090| 64 4c 69 73 74 2e 63 70 | 0d 0d 09 43 6f 6e 74 61 |dList.cp|...Conta|
|000000a0| 69 6e 73 3a 09 41 20 6c | 61 6d 65 20 6c 69 6e 6b |ins:.A l|ame link|
|000000b0| 65 64 20 6c 69 73 74 20 | 63 6c 61 73 73 0d 09 09 |ed list |class...|
|000000c0| 09 09 0d 09 57 72 69 74 | 74 65 6e 20 62 79 3a 20 |....Writ|ten by: |
|000000d0| 4b 65 6e 74 20 4d 69 6c | 6c 65 72 0d 09 0d 09 43 |Kent Mil|ler....C|
|000000e0| 6f 70 79 72 69 67 68 74 | 3a 09 a9 20 31 39 39 35 |opyright|:.. 1995|
|000000f0| 20 41 70 70 6c 65 20 43 | 6f 6d 70 75 74 65 72 0d | Apple C|omputer.|
|00000100| 0d 09 4e 6f 74 65 73 3a | 09 09 57 68 65 6e 20 49 |..Notes:|..When I|
|00000110| 20 73 74 61 72 74 65 64 | 20 77 72 69 74 69 6e 67 | started| writing|
|00000120| 20 74 68 69 73 20 73 61 | 6d 70 6c 65 20 63 6f 64 | this sa|mple cod|
|00000130| 65 2c 20 74 68 65 72 65 | 20 77 61 73 6e 27 74 20 |e, there| wasn't |
|00000140| 61 0d 09 09 09 09 4c 69 | 6e 6b 65 64 4c 69 73 74 |a.....Li|nkedList|
|00000150| 20 63 6c 61 73 73 20 69 | 6e 20 53 70 72 6f 63 6b | class i|n Sprock|
|00000160| 65 74 2e 20 20 49 6e 20 | 44 61 76 65 27 73 20 4a |et. In |Dave's J|
|00000170| 61 6e 75 61 72 79 20 39 | 36 20 75 70 64 61 74 65 |anuary 9|6 update|
|00000180| 0d 09 09 09 09 74 6f 20 | 53 70 72 6f 63 6b 65 74 |.....to |Sprocket|
|00000190| 2c 20 68 65 20 69 6e 63 | 6c 75 64 65 64 20 61 20 |, he inc|luded a |
|000001a0| 62 65 74 74 65 72 20 6c | 69 6e 6b 65 64 20 6c 69 |better l|inked li|
|000001b0| 73 74 20 63 6c 61 73 73 | 20 62 75 74 20 49 27 6d |st class| but I'm|
|000001c0| 0d 09 09 09 09 74 6f 6f | 20 6c 61 7a 79 20 74 6f |.....too| lazy to|
|000001d0| 20 72 65 76 69 73 65 20 | 74 68 69 73 20 70 72 6f | revise |this pro|
|000001e0| 67 72 61 6d 20 75 73 65 | 20 68 69 73 20 63 6c 61 |gram use| his cla|
|000001f0| 73 73 2e 0d 0d 09 43 68 | 61 6e 67 65 20 48 69 73 |ss....Ch|ange His|
|00000200| 74 6f 72 79 20 28 6d 6f | 73 74 20 72 65 63 65 6e |tory (mo|st recen|
|00000210| 74 20 66 69 72 73 74 29 | 3a 0d 0d 20 2a 2f 0d 0d |t first)|:.. */..|
|00000220| 23 69 6e 63 6c 75 64 65 | 20 22 4c 69 6e 6b 65 64 |#include| "Linked|
|00000230| 4c 69 73 74 2e 68 22 0d | 0d 54 4c 69 6e 6b 65 64 |List.h".|.TLinked|
|00000240| 4c 69 73 74 3a 3a 54 4c | 69 6e 6b 65 64 4c 69 73 |List::TL|inkedLis|
|00000250| 74 28 29 0d 09 7b 0d 09 | 74 68 69 73 2d 3e 68 65 |t()..{..|this->he|
|00000260| 61 64 20 3d 20 6e 69 6c | 3b 0d 09 7d 0d 09 0d 54 |ad = nil|;..}...T|
|00000270| 4c 69 6e 6b 65 64 4c 69 | 73 74 3a 3a 7e 54 4c 69 |LinkedLi|st::~TLi|
|00000280| 6e 6b 65 64 4c 69 73 74 | 28 29 0d 09 7b 0d 09 69 |nkedList|()..{..i|
|00000290| 66 20 28 74 68 69 73 2d | 3e 68 65 61 64 20 21 3d |f (this-|>head !=|
|000002a0| 20 6e 69 6c 29 0d 09 09 | 7b 0d 09 09 77 68 69 6c | nil)...|{...whil|
|000002b0| 65 20 28 74 68 69 73 2d | 3e 68 65 61 64 20 21 3d |e (this-|>head !=|
|000002c0| 20 6e 69 6c 29 0d 09 09 | 09 74 68 69 73 2d 3e 52 | nil)...|.this->R|
|000002d0| 65 6d 6f 76 65 46 72 6f | 6d 4c 69 73 74 28 74 68 |emoveFro|mList(th|
|000002e0| 69 73 2d 3e 68 65 61 64 | 2d 3e 65 6c 65 6d 29 3b |is->head|->elem);|
|000002f0| 0d 09 09 0d 09 09 7d 0d | 09 7d 0d 09 0d 76 6f 69 |......}.|.}...voi|
|00000300| 64 20 2a 0d 54 4c 69 6e | 6b 65 64 4c 69 73 74 3a |d *.TLin|kedList:|
|00000310| 3a 52 65 6d 6f 76 65 46 | 72 6f 6d 4c 69 73 74 20 |:RemoveF|romList |
|00000320| 28 76 6f 69 64 20 2a 20 | 6f 62 6a 29 0d 09 7b 0d |(void * |obj)..{.|
|00000330| 09 4c 69 73 74 45 6c 65 | 6d 20 2a 74 72 61 69 6c |.ListEle|m *trail|
|00000340| 65 72 20 3d 20 74 68 69 | 73 2d 3e 68 65 61 64 3b |er = thi|s->head;|
|00000350| 0d 09 4c 69 73 74 45 6c | 65 6d 20 2a 74 68 65 4c |..ListEl|em *theL|
|00000360| 69 73 74 20 3d 20 74 68 | 69 73 2d 3e 68 65 61 64 |ist = th|is->head|
|00000370| 3b 0d 09 76 6f 69 64 20 | 2a 20 65 6c 65 6d 3b 0d |;..void |* elem;.|
|00000380| 09 0d 09 77 68 69 6c 65 | 20 28 28 74 68 65 4c 69 |...while| ((theLi|
|00000390| 73 74 20 21 3d 20 6e 69 | 6c 29 20 26 26 20 28 74 |st != ni|l) && (t|
|000003a0| 68 65 4c 69 73 74 2d 3e | 65 6c 65 6d 20 21 3d 20 |heList->|elem != |
|000003b0| 6f 62 6a 29 29 0d 09 09 | 7b 0d 09 09 74 72 61 69 |obj))...|{...trai|
|000003c0| 6c 65 72 20 3d 20 74 68 | 65 4c 69 73 74 3b 0d 09 |ler = th|eList;..|
|000003d0| 09 74 68 65 4c 69 73 74 | 20 3d 20 74 68 65 4c 69 |.theList| = theLi|
|000003e0| 73 74 2d 3e 6e 65 78 74 | 3b 0d 09 09 7d 0d 09 0d |st->next|;...}...|
|000003f0| 09 69 66 20 28 74 68 65 | 4c 69 73 74 20 3d 3d 20 |.if (the|List == |
|00000400| 6e 69 6c 29 0d 09 09 72 | 65 74 75 72 6e 20 6e 69 |nil)...r|eturn ni|
|00000410| 6c 3b 0d 0d 09 65 6c 65 | 6d 20 3d 20 74 68 65 4c |l;...ele|m = theL|
|00000420| 69 73 74 2d 3e 65 6c 65 | 6d 3b 0d 09 69 66 20 28 |ist->ele|m;..if (|
|00000430| 74 68 65 4c 69 73 74 20 | 3d 3d 20 74 68 69 73 2d |theList |== this-|
|00000440| 3e 68 65 61 64 29 0d 09 | 09 7b 0d 09 09 74 68 69 |>head)..|.{...thi|
|00000450| 73 2d 3e 68 65 61 64 20 | 3d 20 74 68 69 73 2d 3e |s->head |= this->|
|00000460| 68 65 61 64 2d 3e 6e 65 | 78 74 3b 0d 09 09 44 69 |head->ne|xt;...Di|
|00000470| 73 70 6f 73 65 50 74 72 | 20 28 20 28 50 74 72 29 |sposePtr| ( (Ptr)|
|00000480| 20 74 68 65 4c 69 73 74 | 29 3b 0d 09 09 7d 0d 09 | theList|);...}..|
|00000490| 65 6c 73 65 0d 09 09 7b | 09 09 0d 09 09 74 72 61 |else...{|.....tra|
|000004a0| 69 6c 65 72 2d 3e 6e 65 | 78 74 20 3d 20 74 68 65 |iler->ne|xt = the|
|000004b0| 4c 69 73 74 2d 3e 6e 65 | 78 74 3b 0d 09 09 44 69 |List->ne|xt;...Di|
|000004c0| 73 70 6f 73 65 50 74 72 | 20 28 20 28 50 74 72 29 |sposePtr| ( (Ptr)|
|000004d0| 20 74 68 65 4c 69 73 74 | 29 3b 0d 09 09 7d 0d 09 | theList|);...}..|
|000004e0| 0d 09 72 65 74 75 72 6e | 20 65 6c 65 6d 3b 0d 09 |..return| elem;..|
|000004f0| 7d 0d 09 0d 09 0d 76 6f | 69 64 0d 54 4c 69 6e 6b |}.....vo|id.TLink|
|00000500| 65 64 4c 69 73 74 3a 3a | 41 64 64 54 6f 4c 69 73 |edList::|AddToLis|
|00000510| 74 20 28 76 6f 69 64 20 | 2a 20 6f 62 6a 29 0d 09 |t (void |* obj)..|
|00000520| 7b 0d 09 4c 69 73 74 45 | 6c 65 6d 20 2a 74 68 65 |{..ListE|lem *the|
|00000530| 4c 69 73 74 3b 0d 09 0d | 09 74 68 65 4c 69 73 74 |List;...|.theList|
|00000540| 20 3d 20 28 4c 69 73 74 | 45 6c 65 6d 20 2a 29 20 | = (List|Elem *) |
|00000550| 4e 65 77 50 74 72 20 28 | 73 69 7a 65 6f 66 20 28 |NewPtr (|sizeof (|
|00000560| 4c 69 73 74 45 6c 65 6d | 29 29 3b 0d 09 74 68 65 |ListElem|));..the|
|00000570| 4c 69 73 74 2d 3e 65 6c | 65 6d 20 3d 20 6f 62 6a |List->el|em = obj|
|00000580| 3b 0d 09 74 68 65 4c 69 | 73 74 2d 3e 6e 65 78 74 |;..theLi|st->next|
|00000590| 20 3d 20 74 68 69 73 2d | 3e 68 65 61 64 3b 0d 09 | = this-|>head;..|
|000005a0| 74 68 69 73 2d 3e 68 65 | 61 64 20 3d 20 74 68 65 |this->he|ad = the|
|000005b0| 4c 69 73 74 3b 0d 09 7d | 0d 09 0d 76 6f 69 64 20 |List;..}|...void |
|000005c0| 2a 09 0d 54 4c 69 6e 6b | 65 64 4c 69 73 74 3a 3a |*..TLink|edList::|
|000005d0| 47 65 74 46 69 72 73 74 | 4c 69 73 74 45 6c 65 6d |GetFirst|ListElem|
|000005e0| 28 29 0d 09 7b 0d 09 69 | 66 20 28 74 68 69 73 2d |()..{..i|f (this-|
|000005f0| 3e 68 65 61 64 29 0d 09 | 09 72 65 74 75 72 6e 20 |>head)..|.return |
|00000600| 74 68 69 73 2d 3e 68 65 | 61 64 2d 3e 65 6c 65 6d |this->he|ad->elem|
|00000610| 3b 0d 09 65 6c 73 65 0d | 09 09 72 65 74 75 72 6e |;..else.|..return|
|00000620| 20 6e 69 6c 3b 0d 09 7d | 0d 0d 53 49 6e 74 31 36 | nil;..}|..SInt16|
|00000630| 0d 54 4c 69 6e 6b 65 64 | 4c 69 73 74 3a 3a 43 6f |.TLinked|List::Co|
|00000640| 75 6e 74 4c 69 73 74 49 | 74 65 6d 73 28 29 0d 09 |untListI|tems()..|
|00000650| 7b 0d 09 4c 69 73 74 45 | 6c 65 6d 20 09 2a 20 74 |{..ListE|lem .* t|
|00000660| 68 65 4c 69 73 74 20 3d | 20 74 68 69 73 2d 3e 68 |heList =| this->h|
|00000670| 65 61 64 3b 0d 09 53 49 | 6e 74 31 36 20 09 09 63 |ead;..SI|nt16 ..c|
|00000680| 6f 75 6e 74 20 3d 20 30 | 3b 0d 0d 09 77 68 69 6c |ount = 0|;...whil|
|00000690| 65 20 28 74 68 65 4c 69 | 73 74 29 0d 09 09 7b 0d |e (theLi|st)...{.|
|000006a0| 09 09 63 6f 75 6e 74 2b | 2b 3b 0d 09 09 74 68 65 |..count+|+;...the|
|000006b0| 4c 69 73 74 20 3d 20 74 | 68 65 4c 69 73 74 2d 3e |List = t|heList->|
|000006c0| 6e 65 78 74 3b 0d 09 09 | 7d 0d 09 0d 09 72 65 74 |next;...|}....ret|
|000006d0| 75 72 6e 20 63 6f 75 6e | 74 3b 0d 09 7d 0d 0d 76 |urn coun|t;..}..v|
|000006e0| 6f 69 64 20 2a 09 0d 54 | 4c 69 6e 6b 65 64 4c 69 |oid *..T|LinkedLi|
|000006f0| 73 74 3a 3a 47 65 74 4e | 65 78 74 4c 69 73 74 45 |st::GetN|extListE|
|00000700| 6c 65 6d 28 76 6f 69 64 | 20 2a 20 6f 62 6a 29 0d |lem(void| * obj).|
|00000710| 09 7b 0d 09 4c 69 73 74 | 45 6c 65 6d 20 09 2a 20 |.{..List|Elem .* |
|00000720| 74 68 65 4c 69 73 74 20 | 3d 20 74 68 69 73 2d 3e |theList |= this->|
|00000730| 68 65 61 64 3b 0d 0d 09 | 77 68 69 6c 65 20 28 28 |head;...|while ((|
|00000740| 74 68 65 4c 69 73 74 20 | 21 3d 20 6e 69 6c 29 20 |theList |!= nil) |
|00000750| 26 26 20 28 74 68 65 4c | 69 73 74 2d 3e 65 6c 65 |&& (theL|ist->ele|
|00000760| 6d 20 21 3d 20 6f 62 6a | 29 29 0d 09 09 74 68 65 |m != obj|))...the|
|00000770| 4c 69 73 74 20 3d 20 74 | 68 65 4c 69 73 74 2d 3e |List = t|heList->|
|00000780| 6e 65 78 74 3b 0d 09 09 | 0d 09 69 66 20 28 74 68 |next;...|..if (th|
|00000790| 65 4c 69 73 74 20 3d 3d | 20 6e 69 6c 29 0d 09 09 |eList ==| nil)...|
|000007a0| 72 65 74 75 72 6e 20 6e | 69 6c 3b 0d 09 65 6c 73 |return n|il;..els|
|000007b0| 65 20 69 66 20 28 74 68 | 65 4c 69 73 74 2d 3e 6e |e if (th|eList->n|
|000007c0| 65 78 74 20 3d 3d 20 6e | 69 6c 29 0d 09 09 72 65 |ext == n|il)...re|
|000007d0| 74 75 72 6e 20 6e 69 6c | 3b 0d 09 65 6c 73 65 0d |turn nil|;..else.|
|000007e0| 09 09 72 65 74 75 72 6e | 20 74 68 65 4c 69 73 74 |..return| theList|
|000007f0| 2d 3e 6e 65 78 74 2d 3e | 65 6c 65 6d 3b 0d 0d 09 |->next->|elem;...|
|00000800| 7d 0d 0d 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |}.......|........|
|00000810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000860| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000870| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000880| 00 00 01 00 00 00 01 54 | 00 00 00 54 00 00 00 46 |.......T|...T...F|
|00000890| 42 00 00 00 3e 03 f0 ff | ff 00 00 00 69 00 00 00 |B...>...|....i...|
|000008a0| 00 03 ed ff ff 00 00 00 | 8b 00 00 00 00 00 80 00 |........|........|
|000008b0| 0d 4c 69 6e 6b 65 64 4c | 69 73 74 2e 63 70 02 00 |.LinkedL|ist.cp..|
|000008c0| 00 00 54 45 58 54 43 57 | 49 45 01 00 00 a2 00 4f |..TEXTCW|IE.....O|
|000008d0| 00 00 54 45 58 54 43 57 | 49 45 01 00 00 a2 00 4f |..TEXTCW|IE.....O|
|000008e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008f0| 00 00 ac c8 5d d2 00 00 | 07 83 00 00 01 9a 6a 02 |....]...|......j.|
|00000900| 7d 00 f8 00 19 02 6a 02 | 7d ac d5 89 1a 00 00 00 |}.....j.|}.......|
|00000910| ae 00 00 00 ae 00 00 07 | 55 01 00 39 3f ed 65 4a |........|U..9?.eJ|
|00000920| 01 5c 29 0f c7 6a 09 9a | b0 1a 21 f1 b5 f5 22 31 |.\)..j..|..!..."1|
|00000930| fa 5e 0b cb 6d 9f 6b d5 | b9 5d e3 73 59 2a 7e cb |.^..m.k.|.].sY*~.|
|00000940| e5 b8 fd 7c 5b c7 bd bd | 51 35 34 6f e5 35 d0 9f |...|[...|Q54o.5..|
|00000950| a7 08 9e c8 32 23 84 48 | 13 0c f9 78 2c 7c 41 bc |....2#.H|...x,|A.|
|00000960| 23 32 92 28 3c 88 6e 04 | c7 c0 33 c2 30 45 2a 92 |#2.(<.n.|..3.0E*.|
|00000970| 11 06 0b 5d fc 09 06 52 | d1 97 c7 ae 26 71 b5 a7 |...]...R|....&q..|
|00000980| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|00000990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009a0| 00 00 00 00 00 00 00 03 | 00 04 00 42 00 a6 03 68 |........|...B...h|
|000009b0| 03 05 00 42 00 a6 03 68 | 03 05 ad 4f 81 99 00 00 |...B...h|...O....|
|000009c0| 01 59 00 00 01 59 00 00 | 00 00 01 00 00 00 00 04 |.Y...Y..|........|
|000009d0| 00 01 00 01 00 00 01 00 | 00 00 01 54 00 00 00 54 |........|...T...T|
|000009e0| 00 00 00 46 01 94 f4 e0 | 24 5c 00 00 00 1c 00 46 |...F....|$\.....F|
|000009f0| 00 01 4d 50 53 52 00 00 | 00 12 4d 57 42 42 00 00 |..MPSR..|..MWBB..|
|00000a00| 00 1e 03 ed ff ff 00 00 | 00 00 00 00 00 00 03 f0 |........|........|
|00000a10| ff ff 00 00 00 4c 00 00 | 00 00 00 00 00 00 00 00 |.....L..|........|
|00000a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+